package com.xqyq.model;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "prize")
public class Prize {
	private int prize_id;
	// 奖项名字
	private String prize_name;
	// 赛事
	private Match match;
	// 获奖人员
	private List<Sign> sign;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	public int getPrize_id() {
		return prize_id;
	}

	public void setPrize_id(int prize_id) {
		this.prize_id = prize_id;
	}

	@Column(length = 20, nullable = false)
	public String getPrize_name() {
		return prize_name;
	}

	public void setPrize_name(String prize_name) {
		this.prize_name = prize_name;
	}

	@ManyToOne(cascade = { CascadeType.REFRESH }, fetch = FetchType.EAGER)
	@JoinColumn(name = "match_id")
	public Match getMatch() {
		return match;
	}

	public void setMatch(Match match) {
		this.match = match;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "prize")
	public List<Sign> getSign() {
		return sign;
	}

	public void setSign(List<Sign> sign) {
		this.sign = sign;
	}

	@Override
	public String toString() {
		return "Prize [prize_id=" + prize_id + ", prize_name=" + prize_name
				+ "]";
	}

}
